'''
元组：
特点：
    不可修改、有序的、存放多种数据类型、安全性比较高
'''
# 1、元组的创建
# 使用 () 创建元组
tuple_a = (11,22,33)
tuple_b = (11,22,'hello')
tuple_c = (11,22,'hello',tuple_b)
tuple_d = (11,) # 注意一下：只有一个元素，逗号也必须得有
print(tuple_a)
print(tuple_b)
print(tuple_c)
print(tuple_d)

# 使用tuple()方法创建元组
t_a = tuple('hello')
t_b = tuple(['hello','world'])
t_c = tuple(range(5))
print(t_a)
print(t_b)
print(t_c)

# 案例：
course_tuple = ('java','bigdata','test','html')
print(course_tuple)

# 2、元组的访问
course_tuple = ('java','bigdata','test','html')
#               0       1           2       3
#               -4       -3          -2       -1

# 使用下标（索引）访问
print(course_tuple[2])
print(course_tuple[-2])

# 使用切片访问
print(course_tuple[:3])
print(course_tuple[1:3])
print(course_tuple[0:3:2])

# for遍历访问
for course in course_tuple:
    print(course)

# 注意：元组不支持增、删、改
score_tuple = (11,22,65,89,23,0)
print(len(score_tuple))
print(max(score_tuple))
print(min(score_tuple))
print(sum(score_tuple))